import React from 'react'
import Icon from '@ant-design/icons'

import TasksSvg from './task.svg'
import UsersSvg from './users.svg'
import PermissionsSvg from './permissions.svg'
import MenusSvg from './menus.svg'
import LogsSvg from './logs.svg'

export function generateIcon(icon, style = {}) {
  let component = ''
  let icons = {
    task: TasksSvg,
    users: UsersSvg,
    permissions: PermissionsSvg,
    menus: MenusSvg,
    logs: LogsSvg,
  }
  if (icons.hasOwnProperty(icon)) {
    component = icons[icon]
    return <Icon component={component} style={style} />
  }
  return ''
}
